
#define BUF_LINES(o)	(((PvBufferObject *)(o))->lines)
#define BUF_NAME(o)		(((PvBufferObject *)(o))->name)
#define BUF_FFNAME(o)	(((PvBufferObject *)(o))->ffname)
#define BUF_BNAME(o)	(((PvBufferObject *)(o))->bname)
#define BUF_ENCODING(o)	(((PvBufferObject *)(o))->encoding)
#define BUF_LINEBR(o)	(((PvBufferObject *)(o))->linebr)
#define BUF_LEN(o)		PyList_Size(BUF_LINES(o))

#define PvBuffer_IsEmpty(o) (PyList_Size(BUF_LINES(o)) == 0)
#define PvBuffer_CheckExact(op) (Py_TYPE(op) == &PvBuffer_Type)
#define PvBuffer_DelLine(o, n) (PvBuffer_Remove((o), (n), 0, -1))

extern PyTypeObject	PvBuffer_Type;

PyObject *PvBuffer_Insert(PyObject *self, Py_ssize_t lnum, Py_ssize_t off, PyObject *text);
PyObject *PvBuffer_Read(PyObject *self, wchar_t *name, wchar_t *encoding);
PyObject *PvBuffer_GetLine(PyObject *self, int lnum);
PyObject *PvBuffer_Remove(PyObject *self, Py_ssize_t lnum, Py_ssize_t start, Py_ssize_t end);
